package com.TocaLetras;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;

public class LetraCorrectaActivity extends Activity {
	private ImageButton  btn_salir;
	private ImageView Figura;
	private ImageView Palabra;
	@Override
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.letra_correcta);
        Figura = (ImageView) this.findViewById(R.id.img_letra_correcta_dibujo);
        Palabra = (ImageView) this.findViewById(R.id.img_letra_correcta_palabra);
        iniciar();
        addListeners();
    }
	
	public void addListeners(){
	    	 btn_salir = (ImageButton)findViewById(R.id.btn_letra_correcta_continuar);
	    	 btn_salir.setOnClickListener( new View.OnClickListener() {
				
				public void onClick(View v) {
					if(getIntent().getExtras().getInt("cont")==4){
						Intent inten = new Intent(getApplicationContext(),ResultadoActivity.class);
		  				inten.putExtra("mkey","Hola");
		  				startActivityForResult(inten,0);
		  				finish();
					}else{
						Intent intent = new Intent();
						intent.putExtra("resultado",true);
						setResult(RESULT_OK, intent);
					}
					finish();
				}
				
			});
	}
	
	public void iniciar(){
		if(getIntent().getExtras().getInt("cont")==2){
			Figura.setBackgroundResource(R.drawable.carro_respuesta);
			Palabra.setBackgroundResource(R.drawable.carro_respuesta_imagen);
		}else if(getIntent().getExtras().getInt("cont")==3){
			Figura.setBackgroundResource(R.drawable.laarana);
			Palabra.setBackgroundResource(R.drawable.arana2);
		}else if(getIntent().getExtras().getInt("cont")==4){
			Figura.setBackgroundResource(R.drawable.estrella_imagen);
			Palabra.setBackgroundResource(R.drawable.estrella);
		}
	}
}
